﻿<#import "/common/function.ftl" as fn>
<@fn.header _title="">
<#import "/spring.ftl" as spring />
<script type="text/javascript" src="${base}/resources/script/jquery.validate.js"></script>
<script type="text/javascript" src="${base}/resources/script/jquery.validate.methods.js"></script>
<script type="text/javascript">
$(function() {
	var $validateErrorContainer = $("#validateErrorContainer");
	var $validateErrorLabelContainer = $("#validateErrorContainer ul");
	var $validateForm = $("#validateForm");
	
	// 表单验证
	$validateForm.validate({
		errorContainer: $validateErrorContainer,
		errorLabelContainer: $validateErrorLabelContainer,
		wrapper: "li",
		errorClass: "validateError",
		ignoreTitle: true,
		rules: {
			"typeName": "required",
			"typeCode": "required",
			"name": "required",
			"code": "required",
			"hasChildren": "required",
		},
		messages: {
			"typeName": "请填写类别名称",
			"typeCode": "请填写类别代码",
			"name": "请填写属性名称",
			"code": "请填写属性代码",
			"hasChildren": "请选择是否有子节点",
		},
		submitHandler: function(form) {
			$(form).find(":submit").attr("disabled", true);
			form.submit();
		}
	});	
});

</script>
</@fn.header>
<body style="width:100%" class="list">
<form id="validateForm" action="<#if isAddAction>save<#else>update</#if>" method="post">
	<h2><img src="${base}/resources/style/images/iconDivM.gif" width="16" height="16" />用户管理</h2>
	<div id="validateErrorContainer" class="validateErrorContainer marginTop15" style="display:none;">
		<div class="validateErrorTitle">以下信息填写有误,请重新填写</div>
		<ul></ul>
	</div>
	<div class="title marginTop15">
		<div class="title-middle">
			<div class="title-left"></div>
			<div class="title-caption"><#if isAddAction>添加字典<#else>编辑用户</#if></div>
            <div class="title-right"></div>
		</div>
	</div>
	<table class="table3" id="userListTable">
		<tr><th>类别名称</th><td><input type="text" name="typeName" class="formText" value="${(dictionary.typeName)!}" /> <label class="requireField"><font style="font-weight:bold">${(error)!}</font>*</label></td></tr>
		<tr><th>类别代码</th><td><input type="text" name="typeCode" class="formText" value="${(dictionary.typeCode)!}" /> <label class="requireField"><#if dictionary!=null><@spring.bind "dictionary.typeCode" /><@spring.showErrors "br"/><#else>*</#if></label></td></tr>
		<tr><th>属性名称</th><td><input type="text" name="name" class="formText" value="${(dictionary.name)!}" /> <label class="requireField">*</label></td></tr>
		<tr><th>属性代码</th><td><input type="text" name="code" class="formText" value="${(dictionary.code)!}" /> <label class="requireField"><#if dictionary!=null><@spring.bind "dictionary.code" /><@spring.showErrors "br"/><#else>*</#if></label></td></tr>
		<tr><th>是否有子节点</th>
			<td>
				<select name="hasChildren">
					<option value="">请选择</option>
					<option value="1" <#if dictionary!=null><#if dictionary.hasChildren == true>selected</#if></#if>>是</option>
					<option value="0" <#if dictionary!=null><#if !dictionary.hasChildren == false>selected</#if></#if>>否</option>
				</select>
				<label class="requireField">*</label>
			</td>
		</tr>
	</table>
	<input type="submit" class="button" value="确 定" />
	<input type="button" class="button" value="返 回" onclick="javascript:history.go(-1);" />
</form>
</body>
</html>
